/**
 * Generate code from /{{projectName}}-core/src/main/java/{{packageName}}/core/{{modules}}/domain/{{entities@SQL}}.java.hbs
 */
package cn.ibizlab.core.open.domain;

import java.util.*;
import cn.ibizlab.util.domain.IEntity;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.util.*;
import org.springframework.data.annotation.*;
import cn.ibizlab.util.annotation.*;
import cn.ibizlab.util.enums.*;
import cn.ibizlab.util.domain.EntityMP;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.Accessors;
import io.swagger.annotations.*;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import cn.ibizlab.core.open.domain.OpenAccessAuth;

/**
 * 开放接入实体类[OpenAccess]
 *
 * @author generator
 */
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
@JsonIgnoreProperties(value = "handler")
@TableName(value = "OPEN_ACCESS", resultMap = "OpenAccessResultMap")
@ApiModel(value = "OPEN_ACCESS", description = "开放接入")
public class OpenAccess extends EntityMP implements Serializable
{

    /**
     * 标识
     */
    @Id
    @TableId(value = "id" , type = IdType.ASSIGN_UUID)
    @DEField(name = "id" , isKeyField = true)
    @JsonProperty("id")
    @JSONField(name = "id")
    @ApiModelProperty(value = "id", notes = "标识")
    private String id;

    /**
     * 名称
     */
    @TableField(value = "name")
    @DEField(name = "name")
    @JsonProperty("name")
    @JSONField(name = "name")
    @ApiModelProperty(value = "name", notes = "名称")
    private String name;

    /**
     * 逻辑有效标记
     */
    @TableField(value = "enabled")
    @TableLogic(value = "1" , delval = "0")
    @DEField(name = "enabled" , preType = DEPredefinedFieldType.LOGICVALID , logicval = "1" , logicdelval = "0" , dict = "YesNo")
    @JsonProperty("enabled")
    @JSONField(name = "enabled")
    @ApiModelProperty(value = "enabled", notes = "逻辑有效标记")
    private Integer enabled;

    /**
     * 创建人
     */
    @TableField(value = "creator" , fill = FieldFill.INSERT)
    @DEField(name = "creator" , preType = DEPredefinedFieldType.CREATEMAN)
    @JsonProperty("creator")
    @JSONField(name = "creator")
    @ApiModelProperty(value = "creator", notes = "创建人")
    private String creator;

    /**
     * 创建时间
     */
    @TableField(value = "create_time" , fill = FieldFill.INSERT)
    @DEField(name = "create_time" , preType = DEPredefinedFieldType.CREATEDATE)
    @JsonProperty("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    @JSONField(name = "create_time" , format = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "create_time", notes = "创建时间")
    private Date createTime;

    /**
     * 最后更新人
     */
    @TableField(value = "updater")
    @DEField(name = "updater" , preType = DEPredefinedFieldType.UPDATEMAN)
    @JsonProperty("updater")
    @JSONField(name = "updater")
    @ApiModelProperty(value = "updater", notes = "最后更新人")
    private String updater;

    /**
     * 最后更新时间
     */
    @TableField(value = "update_time")
    @DEField(name = "update_time" , preType = DEPredefinedFieldType.UPDATEDATE)
    @JsonProperty("update_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    @JSONField(name = "update_time" , format = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "update_time", notes = "最后更新时间")
    private Date updateTime;

    /**
     * DC
     */
    @TableField(value = "dc")
    @DEField(name = "dc")
    @JsonProperty("dc")
    @JSONField(name = "dc")
    @ApiModelProperty(value = "dc", notes = "DC")
    private String dc;

    /**
     * 类型
     */
    @TableField(value = "open_type")
    @DEField(name = "open_type")
    @JsonProperty("open_type")
    @JSONField(name = "open_type")
    @ApiModelProperty(value = "open_type", notes = "类型")
    private String openType;

    /**
     * 授权类型
     */
    @TableField(value = "grant_types")
    @DEField(name = "grant_types")
    @JsonProperty("grant_types")
    @JSONField(name = "grant_types")
    @ApiModelProperty(value = "grant_types", notes = "授权类型")
    private String grantTypes;

    /**
     * AccessKey(AppId)
     */
    @TableField(value = "access_key")
    @DEField(name = "access_key")
    @JsonProperty("access_key")
    @JSONField(name = "access_key")
    @ApiModelProperty(value = "access_key", notes = "AccessKey(AppId)")
    private String accessKey;

    /**
     * SecretKey(AppSecret)
     */
    @TableField(value = "secret_key")
    @DEField(name = "secret_key")
    @JsonProperty("secret_key")
    @JSONField(name = "secret_key")
    @ApiModelProperty(value = "secret_key", notes = "SecretKey(AppSecret)")
    private String secretKey;

    /**
     * RegionId
     */
    @TableField(value = "region_id")
    @DEField(name = "region_id")
    @JsonProperty("region_id")
    @JSONField(name = "region_id")
    @ApiModelProperty(value = "region_id", notes = "RegionId")
    private String regionId;

    /**
     * 管理账号token
     */
    @TableField(value = "access_token")
    @DEField(name = "access_token")
    @JsonProperty("access_token")
    @JSONField(name = "access_token")
    @ApiModelProperty(value = "access_token", notes = "管理账号token")
    private String accessToken;

    /**
     * 管理账号token过期时间
     */
    @TableField(value = "expires_time")
    @DEField(name = "expires_time")
    @JsonProperty("expires_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    @JSONField(name = "expires_time" , format = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "expires_time", notes = "管理账号token过期时间")
    private Date expiresTime;

    /**
     * 是否禁用
     */
    @TableField(value = "disabled")
    @DEField(name = "disabled" , defaultValue = "0" , dict = "YesNo")
    @JsonProperty("disabled")
    @JSONField(name = "disabled")
    @ApiModelProperty(value = "disabled", notes = "是否禁用")
    private Integer disabled;

    /**
     * 重定向地址
     */
    @TableField(value = "redirect_uri")
    @DEField(name = "redirect_uri")
    @JsonProperty("redirect_uri")
    @JSONField(name = "redirect_uri")
    @ApiModelProperty(value = "redirect_uri", notes = "重定向地址")
    private String redirectUri;

    /**
     * 描述
     */
    @TableField(value = "description")
    @DEField(name = "description")
    @JsonProperty("description")
    @JSONField(name = "description")
    @ApiModelProperty(value = "description", notes = "描述")
    private String description;

    /**
     * 默认应用于
     */
    @TableField(value = "dc_default" , exist = false)
    @DEField(name = "dc_default")
    @JsonProperty("dc_default")
    @JSONField(name = "dc_default")
    @ApiModelProperty(value = "dc_default", notes = "默认应用于")
    private String dcDefault;

    /**
     * 预定义类型
     */
    @TableField(value = "predef_type" , exist = false)
    @DEField(name = "predef_type" , dict = "Open_access_type_justAuth")
    @JsonProperty("predef_type")
    @JSONField(name = "predef_type")
    @ApiModelProperty(value = "predef_type", notes = "预定义类型")
    private String predefType;

    /**
     * AgentId
     */
    @TableField(value = "agent_id")
    @DEField(name = "agent_id")
    @JsonProperty("agent_id")
    @JSONField(name = "agent_id")
    @ApiModelProperty(value = "agent_id", notes = "AgentId")
    private String agentId;

    /**
     * 设置 [名称]
     */
    public OpenAccess setName(String name) {
        this.name = name;
        this.modify("name", name);
        return this;
    }

    /**
     * 设置 [DC]
     */
    public OpenAccess setDc(String dc) {
        this.dc = dc;
        this.modify("dc", dc);
        return this;
    }

    /**
     * 设置 [类型]
     */
    public OpenAccess setOpenType(String openType) {
        this.openType = openType;
        this.modify("open_type", openType);
        return this;
    }

    /**
     * 设置 [授权类型]
     */
    public OpenAccess setGrantTypes(String grantTypes) {
        this.grantTypes = grantTypes;
        this.modify("grant_types", grantTypes);
        return this;
    }

    /**
     * 设置 [AccessKey(AppId)]
     */
    public OpenAccess setAccessKey(String accessKey) {
        this.accessKey = accessKey;
        this.modify("access_key", accessKey);
        return this;
    }

    /**
     * 设置 [SecretKey(AppSecret)]
     */
    public OpenAccess setSecretKey(String secretKey) {
        this.secretKey = secretKey;
        this.modify("secret_key", secretKey);
        return this;
    }

    /**
     * 设置 [RegionId]
     */
    public OpenAccess setRegionId(String regionId) {
        this.regionId = regionId;
        this.modify("region_id", regionId);
        return this;
    }

    /**
     * 设置 [管理账号token]
     */
    public OpenAccess setAccessToken(String accessToken) {
        this.accessToken = accessToken;
        this.modify("access_token", accessToken);
        return this;
    }

    /**
     * 设置 [管理账号token过期时间]
     */
    public OpenAccess setExpiresTime(Date expiresTime) {
        this.expiresTime = expiresTime;
        this.modify("expires_time", expiresTime);
        return this;
    }

    /**
     * 设置 [是否禁用]
     */
    public OpenAccess setDisabled(Integer disabled) {
        this.disabled = disabled;
        this.modify("disabled", disabled);
        return this;
    }

    /**
     * 设置 [重定向地址]
     */
    public OpenAccess setRedirectUri(String redirectUri) {
        this.redirectUri = redirectUri;
        this.modify("redirect_uri", redirectUri);
        return this;
    }

    /**
     * 设置 [描述]
     */
    public OpenAccess setDescription(String description) {
        this.description = description;
        this.modify("description", description);
        return this;
    }

    /**
     * 设置 [默认应用于]
     */
    public OpenAccess setDcDefault(String dcDefault) {
        this.dcDefault = dcDefault;
        this.modify("dc_default", dcDefault);
        return this;
    }

    /**
     * 设置 [预定义类型]
     */
    public OpenAccess setPredefType(String predefType) {
        this.predefType = predefType;
        this.modify("predef_type", predefType);
        return this;
    }

    /**
     * 设置 [AgentId]
     */
    public OpenAccess setAgentId(String agentId) {
        this.agentId = agentId;
        this.modify("agent_id", agentId);
        return this;
    }

    /**
     * 复制当前对象数据到目标对象(粘贴重置)
     * @param targetEntity 目标数据对象
     * @param includeEmpty  是否包括空值
     * @param <T>
     * @return
     */
    @Override
    public <T> T pasteTo(T targetEntity, boolean includeEmpty) {
        super.pasteTo(targetEntity, includeEmpty);
        if(targetEntity instanceof IEntity) {
            IEntity entity = ((IEntity) targetEntity);
            entity.reset("id");
        }
        return targetEntity;
    }

}